package demo.practice.backtrack;

import java.util.ArrayList;
import java.util.List;

public class P320 {

    public static void main(String[] args) {
        P320 p320 = new P320();
        p320.generateAbbreviations("word");
    }

    public List<String> generateAbbreviations(String word) {
        List<String> res = new ArrayList<>();
        for (int i = 1; i <= word.length(); i++) {

            for (int j = 0; j <= word.length()-i; j++) {
                StringBuilder sb = new StringBuilder();
                String befor = word.substring(0, j);
                String behind = word.substring(j + i);

                sb.append(befor);
                sb.append(i);

                sb.append(behind);
                res.add(sb.toString());
            }
        }
        return res;
    }
}
